package day_2022_4_to_7.day48;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

/**
 * @author haomin
 * @date 2022/07/04 19:52
 **/
public class Day43_1_PhoneNumber {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String letter = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
        String number = "222333444555666777788899991234567890";
        while(in.hasNext()){
            ArrayList<String> list = new ArrayList<String>();
            int num = in.nextInt();
            for(int i = 0;i < num;i++){
                String str = in.next();
                str = str.replace("-","");
                if(str.length() < 7 || str.length() > 7)
                    continue;
                String ret = "";
                for(int j = 0;j < 7;j++){
                    ret += number.charAt(letter.indexOf(str.charAt(j)));
                }
                ret = ret.substring(0,3)+"-"+ret.substring(3,7);
                if(!list.contains(ret)){
                    list.add(ret);
                }
            }
            Collections.sort(list);
            for(String s : list){
                System.out.println(s);
            }
            System.out.println("");
        }
    }
}